//
//  ObjectSprite.h
//  StarBugs
//
//  Created by ?? ? on 12/28/11.
//  Copyright (c) 2011 antisword@playorca.com. All rights reserved.
//

#ifndef StarBugs_ObjectSprite_h
#define StarBugs_ObjectSprite_h

#include "cocos2d.h"
#include "Box2D.h"

enum{
    objectType_coin,
    objectType_mainStar,
    objectType_sideLine,
    objectType_bound,
    objectType_balloon,
    
    objectType_motor,
    objectType_broken,
    objectType_triangle,//not use
    objectType_normal,
    objectType_mobile,
    
    objectType_Arc,
    objectType_shortFlat,
    objectType_longFlat,
    objectType_arrow,
    objectType_fan,
    
    objectType_tinyRock,
    objectType_wall,
    objectType_boom,
    objectType_box,
    objectType_leaf,
    
    objectType_teleport1,
    objectType_sharp,
    objectType_onewayup,
    objectType_onewaydown,
    objectType_onceway,
    
    objectType_teleport2,
    objectType_teleport3,
    objectType_flipper_L,
    objectType_flipper_R,
    objectType_ufo,
    
    objectType_magnetic,
    objectType_blast, //not use
    objectType_twin,
    objectType_thinlong,
    objectType_thinshort,
    
    objectType_thinCircle,
    objectType_leverBlue,
    objectType_leverRed,
    objectType_leverBarBlue,
    objectType_leverBarRed,
    
    objectType_spiderWeb,
};

#define PTM_RATIO 32.f
using namespace cocos2d;

class ObjectSprite : public cocos2d::CCNode
{
protected:
    cocos2d::CCArray *frameArray;
    cocos2d::CCSize winSize;
    int num;
    int frameMax;
    b2Body * mainBody;
    bool isRepeatForever;
    
public:
    ObjectSprite();
    ~ObjectSprite();
    
    CCPoint position;
    float bodyAngle;
    bool  isFlip;
    
    cocos2d::CCSprite *mainSprite;
    int objectType;
    virtual void setData(CCPoint pt, float angle, bool flip){position = pt; bodyAngle = angle; isFlip = flip;};
    virtual void setFrame(int i, cocos2d::CCSpriteFrame *frame);
    virtual void setBody(b2World* _world){};
    virtual b2Body* getBody(){return mainBody;};
    virtual void startAnimation(bool repeat);
    virtual void tick(float td);
    virtual void pause();
    virtual void resume();
    virtual void removeBody(b2World *_world){};
    
    virtual float getBodyAngle(){return bodyAngle;};
    virtual CCPoint getBodyPosition(){return position;};
    virtual bool getIsFlip(){return isFlip;};
    virtual void setBodyAngle(bool isInv){};
    virtual void setFlip(bool flip){};
    virtual void setMove(CCPoint pt); 
    virtual void resetObstacle(){};
};


#endif
